//
//  LGUserTool.m
//  微博
//
//  Created by MS on 15-12-13.
//  Copyright (c) 2015年 MS. All rights reserved.
//

#import "LGUserTool.h"

#import "LGHttpTool.h"
#import "LGUserParama.h"
#import "LGUserResult.h"
#import "LGAccount.h"
#import "LGAccountTool.h"
#import "LGBaseParama.h"
#import "MJExtension.h"
#import "LGUser.h"
@implementation LGUserTool
+(void)unreadWithSuccess:(void(^)(LGUserResult * result))success failure:(void(^)(NSError * error))failure
{
    //获取参数
    LGUserParama * parama = [LGUserParama parama];
    parama.uid = [LGAccountTool account].uid;
    
    [LGHttpTool GET:@"https://rm.api.weibo.com/2/remind/unread_count.json" parameters:[parama keyValues] success:^(id responseObject) {
        
        LGUserResult * result = [LGUserResult objectWithKeyValues:responseObject];
        if (success) {
            success(result);
        }
        
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];

}

+(void)userNameWithSuccess:(void(^)(LGUser * user))success failure:(void(^)(NSError * error))failure
{
    //获取参数
    LGUserParama * parama = [LGUserParama parama];
    parama.uid = [LGAccountTool account].uid;

    [LGHttpTool GET:@"https://api.weibo.com/2/users/show.json" parameters:parama.keyValues success:^(id responseObject) {
        LGUser * user = [LGUser objectWithKeyValues:responseObject];
        
        if (success) {
            success(user);
        }
        
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
    
    
}
@end
